def calculate_score(data):
    """
    根据宣传考核要求计算分数
    
    参数:
    data (dict): 包含平台和内容信息的字典
    
    返回:
    float: 计算得出的分数
    """
    platform = data.get('platform', '')
    score = 0
    
    # 使用类似switch的结构处理不同平台
    if platform == "新华财经":
        # 每篇3分，若含图片、动图等素材每篇加4分
        score = 3
        if data.get('has_media', False):
            score += 1
    
    elif platform == "学习强国":
        # 每篇3分，若含图片、动图等素材每篇加4分
        score = 3
        if data.get('has_media', False):
            score += 1
    
    elif platform == "国家局网站":
        # 每篇4分
        score = 4
    
    elif platform == "东方烟草报":
        article_type = data.get('article_type', '')
        if article_type == "纯文学类":
            # 纯文学类，固定加1.5分
            score = 1.5
        elif article_type == "通讯类":
            # 通讯类：（千字以上，包括工作通讯、人物通讯）
            if data.get('is_front_page', False):
                score = 2.5  # 头版加2.5分
            else:
                score = 2  # 其他加2分
            
            # 通讯配图每张加0.5分，每篇1分封顶
            image_count = data.get('image_count', 0)
            image_score = min(image_count * 0.5, 1)
            score += image_score
            
        elif article_type in ["新闻", "消息", "图片新闻"]:
            # 每篇（含多图）加0.5分
            score = 0.5
            
        elif article_type == "专题栏目类":
            # 图片每幅加0.5分，2分封顶
            image_count = data.get('image_count', 0)
            score = min(image_count * 0.5, 2)
    
    elif platform == "浙江烟草杂志":
        article_type = data.get('article_type', '')
        fee = data.get('fee', 0)
        
        if article_type == "文字类":
            # 文字类（不包括论文）
            if fee < 100:
                score = 0.5
            elif 100 <= fee < 300:
                score = 1
            elif fee == 300:
                score = 1.2
            elif fee >= 400:
                score = 1.5
        elif article_type == "图片类":
            if fee <= 50:
                score = 0.5
            elif fee == 100:
                score = 0.7
            elif fee > 100:
                # 每增加一个等级加0.2分，1分封顶
                additional_level = (fee - 100) // 50
                score = min(0.7 + additional_level * 0.2, 1)
    
    elif platform == "《中烟报》":
        article_type = data.get('article_type', '')
        fee = data.get('fee', 0)
        
        if article_type == "专版类":
            # 专版类固定加4分，不受2分封顶限制
            score = 4
            return score  # 直接返回，不应用后面的封顶
        elif article_type == "新闻类":
            # 新闻类（包括文字类新闻、图片新闻）
            if fee == 20:
                score = 0.5
            else:
                additional = max(0, (fee - 20) // 10)
                score = min(0.5 + additional * 0.2, 1)
                
        elif article_type == "通讯类":
            if fee == 30:
                score = 1
            else:
                additional = max(0, (fee - 30) // 10)
                score = min(1 + additional * 0.2, 1.5)
                
        elif article_type == "图片类":
            if fee == 20:
                score = 0.3
            else:
                additional = max(0, (fee - 20) // 10)
                score = min(0.3 + additional * 0.2, 1)
                
        elif article_type == "其他文学类":
            if fee == 10:
                score = 0.2
            elif fee == 20:
                score = 0.5
            elif fee == 30:
                score = 1
            elif fee > 30:
                additional = (fee - 30) // 10
                score = min(1 + additional * 0.2, 1.5)
                
        elif article_type == "达人":
            score = 1.2
            
        # 中烟报每篇文章2分封顶（专版类除外）
        score = min(score, 2)
    
    elif platform == "中烟网站":
        # 录用一篇加1分
        score = 1
    
    elif platform == "东烟视频网":
        # 播出，加2分，2分封顶
        score = 2
    
    elif platform == "新华财经-视频":
        # 播出，加3分，上不封顶
        # 这里由于没有额外条件，直接给3分
        score = 3
    
    return score

# 测试函数，用于直接运行脚本进行测试
if __name__ == "__main__":

    
    for case in test_cases:
        print(f"平台: {case['platform']}, 得分: {calculate_score(case)}")
